package cn.wolfcode.crm.util;

import org.springframework.util.StringUtils;
import java.lang.reflect.Method;

/**
 * Created by Administrator on 2020/3/16.
 */
public abstract class PermissionUtil {
	//通过传进来的方法来判断权限注解,并返回权限标识
	public static String handlerExpression(Method method){
		//先拿到类名
		String simpleName = method.getDeclaringClass().getSimpleName();
		//去掉类名前缀Controller
		String controller = simpleName.replace("Controller", "");
		//将类名首字母转为小写
		String className = StringUtils.uncapitalize(controller);
		//拿到方法名
		String methodName = method.getName();
		//将类名和方法名拼接接起来并返回
		return className +":" + methodName;
	}
}
